package com.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.entity.Comment;

@Repository("commentMapper")
public interface CommentDao {
	@Insert("insert into comment values(null,#{user_id},#{content},#{date},#{shop_id},#{good_id},#{likes},#{user_name})")
	public int sendcomment(Comment comment);
	
	@Select("select * from comment where shop_id=#{shop_id} and good_id=#{good_id}")
	public List<Comment> selectcList( @Param("good_id") int g_id,@Param("shop_id") int s_id);
	
	@Select("select * from comment")
	List<Comment> selectAllComment();
	
	@Delete("delete from comment where c_id=#{c_id}")
	int deleteComment(Integer c_id);
	
	@Select("select * from comment where user_id=#{user_id}")
	List<Comment> selectCommentByUserid(@Param("user_id") int userid);
}
